package com.web.music.interfaces;

import java.io.File;
import java.io.InputStream;
import java.util.Map;

import com.web.music.model.Catalog;
import com.web.music.model.Person;

/**
 * Interface for XML file parsing operations.
 * Helps to extract information from XML files of certain structure.  
 */
public interface XmlParser 
{	
	/**
	 * Extracts information about persons from XML file presented as InputStream.
	 * 
	 * @param input - XML file as InputStream
	 * @return a map <person id, person object>
	 */
	public Map<String,Person> extractPersons(InputStream input);

	/**
	 * Extracts information about persons from XML file at specified location.
	 * 
	 * @param file - XML file containing persons data
	 * @return a map <person id, person object>
	 */
	public Map<String,Person> extractPersons(File xmlFile);
	
	/**
	 * Extracts music catalog information from XML file presented as InputStream.
	 * 
	 * @param input - XML file as InputStream
	 * @param persons - a map with Persons for reference
	 * @return catalog object containing data from XML
	 */
	public Catalog extractCatalog(InputStream input, Map<String, Person> persons);
	
	/**
	 * Extracts music catalog information from XML file at specified location.
	 * 
	 * @param file - XML file containing persons data
	 * @param persons - a map with Persons for reference
	 * @return catalog object containing data from XML
	 */
	public Catalog extractCatalog(File xmlFile, Map<String,Person> persons);
}
